<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>对象嵌套</title>
    <script>
      function Employee(name, sex, salary, address) {
        this.name = name
        this.sex = sex
        this.salary = salary
        this.address = address
      }

      function Address(province, city, area) {
        this.province = province
        this.city = city
        this.area = area
      }
      //公司地址
      const addr = new Address('江苏', '苏州', '姑苏区')
      //员工信息,包含公司地址信息
      const emp1 = new Employee('张三', '男', 12000, addr)
      const emp2 = new Employee('李四', '女', 15000, addr)

      //访问对象
      console.log(emp1.address.city)
    </script>
  </head>
  <body></body>
</html>
